test: make the RSA-PSS encode vectors kill the emBits and masking mut… - #70
Merged
Conversation
…ants The Infection run on this PR flaked: the `emBits = modBits - 1` mutant in AbstractRsaPssSigner::sign() escaped, and a local run lost the same coin flip on `0xFF >> $clearBits` in encode(). Neither escape was new to this branch. Both mutants only shift bits in the leading byte of the encoded message, so every test that signs with a random salt catches them only about half the time, and the fixed-salt vector could not catch them at all: with the old salt that byte was 0x6B, whose top and bottom bits are already clear, so the mutated encoders produced the very same signature. Pin the salt to one whose masked data block starts with 0xFF, and add a second vector under the 2047-bit key, which has two excess bits to clear where the 2041-bit key has none. Every bit of the clearing step is then observable in a deterministic signature, for both shapes of modulus. The OpenSSL CLI verifies both vectors (PSS, salt length 32).
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #70 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 290 290
===========================================
Files 44 44
Lines 629 629
===========================================
Hits 629 629 ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



…ants
The Infection run on this PR flaked: the
emBits = modBits - 1mutant in AbstractRsaPssSigner::sign() escaped, and a local run lost the same coin flip on0xFF >> $clearBitsin encode(). Neither escape was new to this branch. Both mutants only shift bits in the leading byte of the encoded message, so every test that signs with a random salt catches them only about half the time, and the fixed-salt vector could not catch them at all: with the old salt that byte was 0x6B, whose top and bottom bits are already clear, so the mutated encoders produced the very same signature.Pin the salt to one whose masked data block starts with 0xFF, and add a second vector under the 2047-bit key, which has two excess bits to clear where the 2041-bit key has none. Every bit of the clearing step is then observable in a deterministic signature, for both shapes of modulus. The OpenSSL CLI verifies both vectors (PSS, salt length 32).